import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Myview from '@/views/Myview'
import Readme from '@/views/About/Readme'
import About from '@/views/About'
import Friends from '@/views/About/friends'
import ChangePage from '@/views/ChangePage'
import PageNumber from '@/views/PageNumber'

Vue.use(VueRouter)

const routes = [
  {
    path: '/index',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    component: About,
    children: [
      {
        path: 'readme',
        component: Readme
      },
      {
        path: 'friends',
        component: Friends
      },
      {
        path: '',
        redirect: 'readme'
      }
    ]
  },
  {
    path: '/Myview',
    name: 'Myview',
    component: Myview
  },
  {
    path: '/ChangePage',
    name: 'ChangePage',
    component: ChangePage
  },
  {
    path: '/ChangePage/:sid',
    name: 'ChangePage',
    component: ChangePage
  },
  {
    path: '/page',
    name: 'Page',
    component: PageNumber
  },
  {
    path: '/page/:myid',
    name: 'Page',
    component: PageNumber
  },
  {
    path: '*',
    redirect: '/index'
  }
  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
]

const router = new VueRouter({
  // mode: 'history',
  // base: process.env.BASE_URL,
  routes
})

export default router
